<template id="resumeList">
  <div>
    <div class="_item" @click="link_bank">
      <span class="sended" v-show="sfytdjl === '1'&& sfdl!='0'">已投</span>
      <div class="newjob_item_row clearfix">
        <span class="job_name overflow">
          <span :class="[sfjpgw ==='1'?'bgPic':'']" v-html="brightenKeyword(job)"></span>
        </span>
        <span class="job_money overflow">
          <!-- <span class="num">{{money}}</span>/月 -->
          <span class="num">{{money}}</span>
        </span>
      </div>
      <div class="newjob_item_row clearfix" :class="[!sfdwxx?'':'last_row']">
        <span
          class="newjob_left maxWidth overflow"
        >{{gzdq}}{{xl?` | ${xl}`:""}}{{gwfbsj?` | ${gwfbsj}`:""}}</span>
        <span
          :class="[ sfytdjl === '1' || sfyjycsqy=='0'? 'not_allowed newjob_right' : 'newjob_right']"
          @click.stop="send(zpgwid,sftxtdjl)"
        >
          <img class="deliver" src="~common/images/deliver.png" style="margin-right:5px;" />投递简历
        </span>
      </div>
      <div class="newjob_item_row last_row clearfix" v-if="!sfdwxx">
        <span class="newjob_left company overflow" :class="[zplxrdh ? '' : 'maxwidth']" v-html="brightenKeyword(company)"></span>
        <!-- <a v-if="zplxrdh" :href="'tel:' + zplxrdh" class="newjob_right phone" @click.stop @click="jump">
          <img class="deliver" src="~common/images/phone.png" />
          一键联系
        </a> -->
        <span v-if="zplxrdh" class="newjob_right phone" @click.stop @click="jump">
          <img class="deliver" src="~common/images/phone.png" />
          一键联系
        </span>
      </div>
    </div>
  </div>
</template>
<script>
import viewNum from '@/common/js/configuration';
export default {
  name: "resumeList",
  props: {
    job: {
      type: String
    },
    money: {
      type: String
    },
    company: {
      type: String
    },
    gzdq: {
      type: String
    },
    dwdjid: {
      type: String
    },
    jlid: {
      type: String
    },
    zpgwid: {
      type: String
    },
    sftxtdjl: {
      type: String
    },
    sfytdjl: {
      type: String
    },
    sfjpgw: {
      type: String
    },
    xl: {
      type: String
    },
    sfdwxx: {
      type: String
    },
    zplxrdh: {
      type: String
    },
    gwfbsj: {
      type: String
    },
    sfyjycsqy: {
      type: String //就业超市单位不能
    },
    // ygxs: {
    //   type: String
    // },
    sfdl: {
      type: String
    },
    lxdhtx:{
      type: String
    },
    homeFlag:{
      type: String
    }
  },
  methods: {
    jump(){
      // this.$loading = true;
      // this.$http.get('/grgl/sfdl').then(res=>{
      //   this.$loading = false;
      //   if (res.sfdl == 1&&res.executeResult == 1) {
        if(this.sfdl == 1){
          viewNum('2014000')
        // 判断是否登录，没有登录
          if (this.lxdhtx) {
            this.$alert(this.lxdhtx);
          }else{
            const href = `tel:${this.zplxrdh}`;
            var a = document.createElement('a');
            a.setAttribute('href', href);
            document.body.appendChild(a);
            a.click();
          }
        }else{
          window.location.href = './public3.html';
          // window.location.href = './login.html';
        }
      // })
    },
    send(gwid, sftxtdjl) {
      if (this.sfdl == '0') {
        // window.location.href = './login.html';
        window.location.href = './public3.html';
        return
      }
      // 是否已投递简历 sfytdjl   1为投递
      if (this.sfytdjl == "1" || this.sfyjycsqy=='0') return;
      this.$http.get("/grgl/sfyqzdj").then(res => {
        const flag = res.returnData.sfyjl; //是否有简历 1有；.
        if (flag != "1") {
          this.$alert("请维护简历信息后投递！");
          return false;
        }
        this.$emit("input", {
          zpgwid: gwid,
          sftxtdjl: sftxtdjl
        });
      });
    },
    brightenKeyword(val){
      const GET_session = sessionStorage.getItem("qwgjz");
      if (GET_session && val) {
        var SearchArr = GET_session.split("");
        var res = val
        for (let i = 0; i < SearchArr.length; i++) {
          let reg=/^[\u2E80-\u9FFF]+$/;
          if(!reg.test(SearchArr[i])) continue
          var Reg = new RegExp(SearchArr[i], 'g');
          res = res.replace(Reg, `<span style="color: #fb4d64;">${SearchArr[i]}</span>`);
        }
        return res;
      }else{
        return val;
      }
    },
    link_bank() {
      this.$emit("link", this.zpgwid, this.dwdjid);
    }
  }
};
</script>
<style lang="scss" scoped>
@import "~common/scss/var.scss";
._item {
  // height: $height-input * 2;
  margin: $height-base/10 0;
  border-radius: $radius-base3;
  background-color: #fff;
  padding: $font-size-base 0 $margin-base 0;
  position: relative;
  .newjob_item_row {
    padding: 0 $padding-btn;
    margin-bottom: $margin-base;
    height: $height-width_line * 2;
    line-height: $height-width_line * 2;
    .job_name {
      color: $color-text-title;
      font-weight: 400;
      width: 58%;
      float: left;
      .bgPic {
        background: url("~common/images/want.png") top right no-repeat;
        background-size: $font-size-large;
        padding-right: $font-size-larges;
      }
    }
    .job_money {
      float: right;
      color: #817e81;
      font-size: $font-size-small;
      width: 42%;
      text-align: right;
      word-wrap: break-word;
      .num {
        color: #fb4d64;
        // font-size: $font-size-large;
        font-size: $font-size-base;
      }
    }
    .newjob_left {
      float: left;
      font-size: $font-size-small;
      color: $color-text-title;
      height: $height-width_line * 2;
      line-height: $height-width_line * 2;
    }
    .maxWidth {
      width: 76%;
    }
    .newjob_right {
      float: right;
      background-color: #ff9900;
      padding: $radius-base;
      width: $radius-base4 * 4;
      height: 100%;
      line-height: 100%;
      box-sizing: border-box;
      color: #fff;
      font-size: $padding-base-half * 3;
      border-radius: $padding-base-half;
      .deliver {
        width: $font-size-small;
        height: $font-size-small;
        vertical-align: text-bottom;
      }
    }
    .not_allowed {
      background-color: #ccc;
    }
    .phone {
      background-color: #3399ff;
    }
    .company {
      background: url("~common/images/company.png") 0 $padding-base-half
        no-repeat;
      background-size: $height-input_base;
      padding-left: $padding-base-half * 4;
      width: 66%;
    }
    .maxwidth {
      width: 98%;
    }
    .term {
      font-size: $font-size-small;
      .item {
        box-sizing: border-box;
      }

      .item:after {
        content: "|";
        margin-left: $padding-base-half;
        color: $color-text-placeholder;
      }

      .item:last-child:after {
        content: "";
      }
    }
    .address {
      padding: $padding-btn 0;
      color: $color-text-title;
    }
  }
  .last_row {
    margin-bottom: 0;
  }
  .sended {
    position: absolute;
    top: 0;
    left: 0;
    font-size: $padding-base;
    width: $font-size-ultra-plus;
    height: $font-size-small;
    line-height: $font-size-small;
    text-align: center;
    background-color: #ccc;
    color: #fff;
  }
}
._item:first-child {
  border-radius: 0 0 $radius-base3 $radius-base3;
  margin-top: 0;
}
</style>
